package com.huawei.rbac;

import org.junit.Test;

import java.util.Scanner;

public class CheckEmail {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        //判断邮箱
        String regex = "[^%&',;=?$\\x22]+";
        //提示语句
        System.out.println("请输入您的密码：");
        while (true) {
            //获取邮箱
            String string = scanner.next();
            if (string.matches(regex)) {
                System.out.println("您输入的邮箱正确,可以登录");
                break;
            } else
                System.out.println("您输入的邮箱错误！请重新输入：");

        }
    }

    @Test
    public void testPassword() throws Exception {


        Scanner scanner = new Scanner(System.in);

        //判断邮箱
        String regex = "[^%&',;=?$\\x22]+";
        //提示语句
        System.out.println("请输入您的密码：");
        while (true) {
            //获取邮箱
            String string = scanner.next();
            if (string.matches(regex)) {
                System.out.println("您输入的邮箱正确,可以登录");
                break;
            } else
                System.out.println("您输入的邮箱错误！请重新输入：");

        }

    }
}